package com.vast.ui.component.providers;

import org.eclipse.jface.viewers.ITableColorProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;

import com.vast.ui.component.models.Item;
import com.vast.ui.component.models.ItemArray;

public class FullcolorledLabelProvider extends LabelProvider implements
ITableLabelProvider, ITableColorProvider {
	private Display display;
	
	public FullcolorledLabelProvider(Display display) {
		this.display  = display;
	}
	
	public Image getColumnImage(Object element, int columnIndex) {
		// TODO Auto-generated method stub
		return null;
	}

	public String getColumnText(Object element, int columnIndex) {
		// TODO Auto-generated method stub
		return null;
	}

	public Color getBackground(Object element, int columnIndex) {
		// TODO Auto-generated method stub
		if(columnIndex == 0) {
			return null;
		} 
		if (element instanceof ItemArray) {
			ItemArray itemArray = (ItemArray)element;
			Item      item      = itemArray.getItem(columnIndex - 1);
		    int r = (item.value >> 16) & 0xFF;
			int g = (item.value >> 8) & 0xFF;
			int b = item.value & 0xFF;
			Color fullColor = new Color(display, r, g, b);;
			return fullColor;
		}
		return null;
	}

	public Color getForeground(Object element, int columnIndex) {
		// TODO Auto-generated method stub
		return null;
	}

}
